package com.shinhye.elephantsafe.db.dao;

import com.shinhye.elephantsafe.domain.ScanInfo;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class AntiVirusDao {

	public static ScanInfo virusQuery(String md5) {
		String path = "/data/data/com.shinhye.elephantsafe/files/antivirus.db";
		SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY);
		
		Cursor cursor = db.rawQuery("select name,desc from datable where md5=?", new String[]{md5});
		ScanInfo virus = new ScanInfo();
		if(cursor.moveToNext()) {
			String name = cursor.getString(0);
			String desc = cursor.getString(1);
			virus.setVirusname(name);
			virus.setDesc(desc);
		}
		
		cursor.close();
		db.close();
		return virus;
	}
}
